﻿using System;
using LoungeRepo.Core;

namespace ChangingTheSchema
{
    class Program
    {
        static void Main()
        {
            using (var repo = new LoungeRepository(@"..\..\..\ChangingTheSchema.Repo"))
            {
                var e1 = repo.Load<FieldsToBeAdded>("fieldsToBeAdded");
                Console.WriteLine("'{0}'; {1} added since entity was stored", e1.F1, e1.F2Added);

                var e2 = repo.Load<FieldsToBeRemoved>("fieldsToBeRemoved");
                Console.WriteLine("'{0}'; second field stored removed in new version of class", e2.F1);

                var e3 = repo.Load<FieldsToChangeType>("fieldsToChangeType");
                Console.WriteLine("'{0}', {1}, '{2}'", e3.F1, e3.F2, e3.F3);

                Console.WriteLine("3 entities loaded");
            }
        }
    }


    class FieldsToBeAdded
    {
        public string F1;
        public int F2Added;
    }

    class FieldsToBeRemoved
    {
        public string F1;
        //public int F2;
    }

    class FieldsToChangeType
    {
        public string F1; // was int
        public double F2; // was int
        public string F3; // was StringBuilder
    }
}
